package org.chen.springbootrabbitmqdemo.msg;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Auther: Mr.chen
 * @Date: 2019/9/12 22:40
 * @Description:
 */
@Slf4j
@Component
public class SenderMsg {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send() {
        String msg = "hello " + System.currentTimeMillis();
        rabbitTemplate.convertAndSend("hello",msg);
        log.info("Sender :{}", msg);
    }

}
